package com.craney.aboutFilter
{
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.filters.BevelFilter;
	import flash.filters.BlurFilter;
	import flash.filters.ConvolutionFilter;
	import flash.filters.DropShadowFilter;
	import flash.filters.GlowFilter;
	import flash.net.URLRequest;
	
	public class BaseTestFilter
	{
		private var parentSprite:Sprite;
		
		private var loader:Loader = new Loader();
		
		public function BaseTestFilter(ps:Sprite)
		{
			
			parentSprite = ps;
			
			var pictAddr:URLRequest = new URLRequest("dog.jpg");
			
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
			
			loader.load(pictAddr);
			trace("OK");
			
			
			
			
		}
		
		private function completeHandler(event:Event):void
		{
			trace("Finished!");
			loader.cacheAsBitmap = true;
			new BlurFilter();
			new GlowFilter();
			new BevelFilter();
			new DropShadowFilter();
//			var a:Array = [new BlurFilter(), new GlowFilter(), new BevelFilter()];
//			loader.filters = [new BlurFilter()];
//			loader.filters = [new GlowFilter()];
//			loader.filters = [new BevelFilter()];
//			loader.filters = [new DropShadowFilter()];
//			loader.filters = [new ConvolutionFilter()];
//			loader.filters = a;
			loader.scaleX = 2;
			loader.scaleY = 2
			loader.x = 200;
			loader.y = 200;
			
			parentSprite.addChild(loader);
			
			
		}

	}
}